In [22]:
# REQUIREMENTS
pip install requests pandas numpy scikit-learn pmdarima tensorflow
Get current date and time¶
In [12]:
from datetime import datetime
now = datetime.now()
print("Today is:", now.strftime("%A, %d %B %Y"))
print("Current time:", now.strftime("%H:%M:%S"))
Today is: Wednesday, 13 August 2025 Current time: 09:33:40
Today is: Wednesday, 13 August 2025¶
In [20]:
============================================================
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ TRX/USDT FORECASTING SYSTEM ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
============================================================
Fetching TRX/USDT historical data...
⚠️ Error from binance: binance GET https://api.binance.com/api/v3/exchangeInfo 451 {
"code": 0,
"msg": "Service unavai... trying next
✓ Fetched TRX/USDT data from kucoin
========================================
──────── Processing 1D interval ────────
========================================
• Calculating 1H window...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 265ms/step
• Calculating 4H window...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 186ms/step
• Calculating 12H window...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 173ms/step
• Calculating 1D window...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 171ms/step
• Calculating 3D window...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 169ms/step
✓ Creating forecast comparison visualization...
✓ Creating window comparison visualization...
✓ Creating model performance visualization (1H window)...
======================================== ──────── Processing 1W interval ──────── ======================================== • Calculating 1H window... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 300ms/step • Calculating 4H window... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 181ms/step • Calculating 12H window... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 175ms/step • Calculating 1D window... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 285ms/step • Calculating 3D window... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 176ms/step ✓ Creating forecast comparison visualization...
✓ Creating window comparison visualization...
✓ Creating model performance visualization (1H window)...
========================================
──────── Processing 1M interval ────────
========================================
⚠️ Insufficient data (17 points). Skipping.
============================================================
☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆ FORECAST RESULTS ☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆☆
============================================================
〔 1D Interval 〕
▣ 1H Window:
ARIMA 1D: $0.354889
LSTM 1D: $0.319411
ARIMA 1M: $0.340756
LSTM 1M: $0.310317
▣ 4H Window:
ARIMA 1D: $0.354889
LSTM 1D: $0.298199
ARIMA 1M: $0.340756
LSTM 1M: $0.300773
▣ 12H Window:
ARIMA 1D: $0.354889
LSTM 1D: $0.315553
ARIMA 1M: $0.340756
LSTM 1M: $0.306094
▣ 1D Window:
ARIMA 1D: $0.354889
LSTM 1D: $0.302733
ARIMA 1M: $0.340756
LSTM 1M: $0.300147
▣ 3D Window:
ARIMA 1D: $0.354889
LSTM 1D: $0.322311
ARIMA 1M: $0.340756
LSTM 1M: $0.315746
〔 1W Interval 〕
▣ 1H Window:
ARIMA 1D: $0.353786
LSTM 1D: $0.252147
ARIMA 1M: $0.335764
LSTM 1M: $0.336100
▣ 4H Window:
ARIMA 1D: $0.353786
LSTM 1D: $0.258260
ARIMA 1M: $0.335764
LSTM 1M: $0.396813
▣ 12H Window:
ARIMA 1D: $0.353786
LSTM 1D: $0.218377
ARIMA 1M: $0.335764
LSTM 1M: $0.368477
▣ 1D Window:
ARIMA 1D: $0.353786
LSTM 1D: $0.254474
ARIMA 1M: $0.335764
LSTM 1M: $0.357300
▣ 3D Window:
ARIMA 1D: $0.353786
LSTM 1D: $0.312474
ARIMA 1M: $0.335764
LSTM 1M: $0.323324
============================================================
VISUALIZATIONS SAVED TO CURRENT DIRECTORY
============================================================
Forecasting complete! Professional charts saved as PNG files.
In [11]:
Starting TRX/USDT forecasting and visualization...
Error from binance: binance GET https://api.binance.com/api/v3/exchangeInfo 451 {
"code": 0,
"msg": "Service unavai... trying next exchange
Successfully fetched TRX/USDT data from kucoin
Processing 1D interval for TRX...
Calculating 1h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 177ms/step
Calculating 3h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 172ms/step
Calculating 6h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 174ms/step
Calculating 12h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 291ms/step
Calculating 1d windows...
WARNING:tensorflow:5 out of the last 5 calls to <function TensorFlowTrainer.make_predict_function.<locals>.one_step_on_data_distributed at 0x7b381821d120> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 193ms/step Calculating 3d windows...
WARNING:tensorflow:6 out of the last 6 calls to <function TensorFlowTrainer.make_predict_function.<locals>.one_step_on_data_distributed at 0x7b3820058360> triggered tf.function retracing. Tracing is expensive and the excessive number of tracings could be due to (1) creating @tf.function repeatedly in a loop, (2) passing tensors with different shapes, (3) passing Python objects instead of tensors. For (1), please define your @tf.function outside of the loop. For (2), @tf.function has reduce_retracing=True option that can avoid unnecessary retracing. For (3), please refer to https://www.tensorflow.org/guide/function#controlling_retracing and https://www.tensorflow.org/api_docs/python/tf/function for more details.
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 181ms/step
Processing 1W interval for TRX... Calculating 1h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 195ms/step Calculating 3h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 175ms/step Calculating 6h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 169ms/step Calculating 12h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 169ms/step Calculating 1d windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 168ms/step Calculating 3d windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 169ms/step
Processing 1M interval for TRX...
Insufficient data (17 points). Skipping.
=== TRX/USDT Forecast Results ===
[1D Interval]
1h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.304990
ARIMA 1M: 0.339669
LSTM 1M: 0.302929
3h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.300383
ARIMA 1M: 0.339669
LSTM 1M: 0.315582
6h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.298249
ARIMA 1M: 0.339669
LSTM 1M: 0.307861
12h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.302986
ARIMA 1M: 0.339669
LSTM 1M: 0.299722
1d window:
ARIMA 1D: 0.353929
LSTM 1D: 0.300622
ARIMA 1M: 0.339669
LSTM 1M: 0.300693
3d window:
ARIMA 1D: 0.353929
LSTM 1D: 0.302258
ARIMA 1M: 0.339669
LSTM 1M: 0.292675
[1W Interval]
1h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.223239
ARIMA 1M: 0.333356
LSTM 1M: 0.353374
3h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.234057
ARIMA 1M: 0.333356
LSTM 1M: 0.400258
6h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.238869
ARIMA 1M: 0.333356
LSTM 1M: 0.370169
12h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.227247
ARIMA 1M: 0.333356
LSTM 1M: 0.371152
1d window:
ARIMA 1D: 0.352612
LSTM 1D: 0.260096
ARIMA 1M: 0.333356
LSTM 1M: 0.287577
3d window:
ARIMA 1D: 0.352612
LSTM 1D: 0.176993
ARIMA 1M: 0.333356
LSTM 1M: 0.350722
TRX forecasting complete! Visualizations saved as PNG files.
In [13]:
Starting TRX/USDT forecasting and visualization...
Error from binance: binance GET https://api.binance.com/api/v3/exchangeInfo 451 {
"code": 0,
"msg": "Service unavai... trying next exchange
Successfully fetched TRX/USDT data from kucoin
Processing 1D interval for TRX...
Calculating 1h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 196ms/step
Calculating 3h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 192ms/step
Calculating 6h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 206ms/step
Calculating 12h windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 295ms/step
Calculating 1d windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 204ms/step
Calculating 3d windows...
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 199ms/step
Processing 1W interval for TRX... Calculating 1h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 342ms/step Calculating 3h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 320ms/step Calculating 6h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 219ms/step Calculating 12h windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 212ms/step Calculating 1d windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 201ms/step Calculating 3d windows... 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 193ms/step
Processing 1M interval for TRX...
Insufficient data (17 points). Skipping.
=== TRX/USDT Forecast Results ===
[1D Interval]
1h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.309232
ARIMA 1M: 0.339669
LSTM 1M: 0.300251
3h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.303373
ARIMA 1M: 0.339669
LSTM 1M: 0.310721
6h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.283693
ARIMA 1M: 0.339669
LSTM 1M: 0.304839
12h window:
ARIMA 1D: 0.353929
LSTM 1D: 0.298886
ARIMA 1M: 0.339669
LSTM 1M: 0.310844
1d window:
ARIMA 1D: 0.353929
LSTM 1D: 0.301331
ARIMA 1M: 0.339669
LSTM 1M: 0.308169
3d window:
ARIMA 1D: 0.353929
LSTM 1D: 0.298410
ARIMA 1M: 0.339669
LSTM 1M: 0.309971
[1W Interval]
1h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.282066
ARIMA 1M: 0.333356
LSTM 1M: 0.425150
3h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.253562
ARIMA 1M: 0.333356
LSTM 1M: 0.392040
6h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.237235
ARIMA 1M: 0.333356
LSTM 1M: 0.245004
12h window:
ARIMA 1D: 0.352612
LSTM 1D: 0.203936
ARIMA 1M: 0.333356
LSTM 1M: 0.384251
1d window:
ARIMA 1D: 0.352612
LSTM 1D: 0.254750
ARIMA 1M: 0.333356
LSTM 1M: 0.351793
3d window:
ARIMA 1D: 0.352612
LSTM 1D: 0.267495
ARIMA 1M: 0.333356
LSTM 1M: 0.422566
TRX forecasting complete! Visualizations saved as PNG files.
In [6]: